package com.maiji.cloud.entities.login;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@NoArgsConstructor
@Data
@Accessors(chain=true)
@Table(name = "app_user")
public class AppUser implements Serializable {

    @TableId
    @Column(name = "uu_id", type = MySqlTypeConstant.VARCHAR, length = 50, isKey = true)
    private String uuId;

    @Column(name = "nick_name", type = MySqlTypeConstant.VARCHAR, length = 20)
    private String nickName;

    @Column(name = "tel", type = MySqlTypeConstant.VARCHAR, length = 20)
    private String tel;

    @Column(name = "open_id", type = MySqlTypeConstant.VARCHAR, length = 50)
    private String openId;

    @Column(name = "qq_id", type = MySqlTypeConstant.VARCHAR, length = 50)
    private String qqId; // QQID

    @Column(name = "wb_id", type = MySqlTypeConstant.VARCHAR, length = 50)
    private String wbId; // 微博ID

    @Column(name = "pwd", type = MySqlTypeConstant.VARCHAR, length = 50)
    private String pwd;

    @Column(name = "token", type = MySqlTypeConstant.VARCHAR, length = 180)
    private String token;

    @Column(name = "token_status", type = MySqlTypeConstant.INT, length = 1)
    private Integer tokenStatus; //token是否失效：1有效，0失效

    @Column(name = "open_id_bd", type = MySqlTypeConstant.VARCHAR, length = 50)
    private String openIdBd;

    @Column(name = "token_bd", type = MySqlTypeConstant.VARCHAR, length = 180)
    private String tokenBd;

    @Column(name = "token_status_bd", type = MySqlTypeConstant.INT, length = 1)
    private Integer tokenStatusBd; //token是否失效：1有效，0失效

    @Column(name = "open_id_wx", type = MySqlTypeConstant.VARCHAR, length = 50)
    private String openIdWx;

    @Column(name = "token_wx", type = MySqlTypeConstant.VARCHAR, length = 180)
    private String tokenWx;

    @Column(name = "token_status_wx", type = MySqlTypeConstant.INT, length = 1)
    private Integer tokenStatusWx; //token是否失效：1有效，0失效

    @Column(name = "reg_date", type = MySqlTypeConstant.DATETIME)
    private Date regDate ;  //注册时间
    
    @Column(name = "distribution_num", type = MySqlTypeConstant.VARCHAR, length = 50)
    private String distributionNum; // 分销码

    @Column(name = "pid", type = MySqlTypeConstant.VARCHAR, length = 50)
    private String pid; // 所属者id
    
    @Column(name = "ratio", type = MySqlTypeConstant.DOUBLE)
	private Double ratio; //旗下的用户下单分红比例
    
    @Column(name = "end_time", type = MySqlTypeConstant.DATETIME)
    private Date endTime ;  //与上级用户代理关系到期时间
   
    @Column(name = "is_cancel", type = MySqlTypeConstant.INT,defaultValue = "0")
    private Integer isCancel; //0正常，1：代理资格取消

    @Column(name = "pid_count", type = MySqlTypeConstant.INT, defaultValue = "0")
    private Integer pidCount; //下级分销人数

    @Column(name = "ppid_count", type = MySqlTypeConstant.INT, defaultValue = "0")
    private Integer ppidCount; //下下级分销人数

    @Column(name = "is_ban", type = MySqlTypeConstant.INT, defaultValue = "0")
    private Integer isBan; //是否禁用

    // 修改者ID
    @TableField(exist = false)
    private List<Date> editDates;

    // 修改者ID
    @TableField(exist = false)
    private String operatorId;

    // 修改者账号
    @TableField(exist = false)
    private String operatorName;

    public AppUser (String uuId, String tel) {
        this.uuId = uuId;
        this.tel = tel;
    }

    public AppUser (String tel) {
        this.tel = tel;
    }

    public AppUser (String token, Integer tokenStatus) {
        this.token = token;
        this.tokenStatus = tokenStatus;
    }

}
